from flask_babel import _
from libs.exception import BaseHTTPException


class HTTPFirewareParamsError(BaseHTTPException):
    error_code = "fver_param_error"
    description = "Fireware Version parameters Error"
    code = 400
    def __init__(self, message: str|None = None):
        if message:
            self.description = message
        super().__init__(self.description)

class HTTPFirewareNotExsitError(BaseHTTPException):
    error_code = "fver_not_exist_error"
    description = "Fireware Version not exsit error"
    code = 400
    def __init__(self, fver_id: str|None = None):
        if fver_id:
            self.description =_("The fireware version is not exist:{fver_id}").format(fver_id=fver_id)
        else:
            self.description = _("The fireware version is not exist.")
        super().__init__(self.description)

class HTTPFVerTaskNotFoundError(BaseHTTPException):
    error_code = "fver_task_not_found_error"
    description = "Fireware Version updating task not found error"
    code = 400
    def __init__(self, task_id: str|None = None):
        if task_id:
            self.description =_("Fireware Version updating task not found error:{task_id}").format(task_id=task_id)
        else:
            self.description =_("Fireware Version updating task not found error")
        super().__init__(self.description)